package center

import (
	"sync"
)

var (
	idtosocket      map[int32]*Conninfo = make(map[int32]*Conninfo)
	sockettoid      map[*Conninfo]int32 = make(map[*Conninfo]int32)
	rwlock_uinfo    sync.RWMutex
	user_List       *List                  = new(List)
	country_map     map[byte]*Country_info = make(map[byte]*Country_info)
	rwlock_country  sync.RWMutex
	scene_List      map[byte]*Scene_info = make(map[byte]*Scene_info)
	scene_List_lock sync.RWMutex
	gen_config_map  map[int32]*Gen_data  = make(map[int32]*Gen_data)  //只读不写
	prop_config_map map[int32]*Prop_data = make(map[int32]*Prop_data) //只读不写
	task_config_map map[int32]*Task_data = make(map[int32]*Task_data)
)

type Scene_info struct {
	scene_id     byte
	rwlock_scene sync.RWMutex
	user_list    map[int32]*User_info //=make(map[int32]*Role_info)
}
type User_info struct {
	rwlock_user sync.RWMutex
	User_base
	pos      User_pos
	genlist  map[int32]*Gen_info
	baglist  map[int32]*Bag_thing
	tasklist map[int32]*Task_user
}
type Task_user struct {
	task_user_id int32
	task_id      int32
	task_type    byte
	user_id      int32
	task_status  byte //0未完成；1已完成
}
type User_pos struct {
	x int32
	y int32
}
type User_base struct {
	user_id   int32
	user_code string
	user_name string
	headid    byte
	country   byte
	city      byte
	scene_id  byte
	silver    int32
	gold      int32
	cd1       int32
	cd2       int32
	cd3       int32
	user_flag int64
}
type Gen_info struct {
	gen_info_id int32
	user_id     int32
	lvone_id    int16
	genlv       int16
	attackval   int32
	defensenval int32
}
type Bag_thing struct {
	bag_thing_id int32
	user_id      int32
	prop_id      int32
	prop_lv      byte
	prop_num     int32
}
type Country_info struct {
	country_id byte
	user_id    int32
	city_list  map[byte]*City_info //=make(map[byte]*City_info)
}
type City_info struct {
	city_id byte
	country byte
	user_id int32
}
type Task_data struct {
	task_id         int32
	task_name       string
	task_type       byte
	task_need_map   map[int32]*Task_need   //任务达成条件
	task_reward_map map[int32]*Task_reward //任务奖励
}
type Task_need struct {
	need_id   int32
	task_id   int32
	need_type byte
	need_val  int32
}
type Task_reward struct {
	reward_id   int32
	task_id     int32
	reward_type byte
	reward_num  int32
}
type Gen_data struct {
	gen_id                  int32
	gen_name                string
	stand_frame_num         byte
	stand_frame_interval    byte
	run_frame_num           byte
	run_frame_interval      byte
	attack_frame_num        byte
	attack_frame_interval   byte
	attacked_frame_num      byte
	attacked_frame_interval byte
	attack_val              int32
	defensen_val            int32
}
type Prop_data struct {
	prop_id      int32
	prop_name    string
	qulitly      byte
	can_overly   byte //是否可叠加
	prop_type    byte
	price_silver int32
	price_gold   int32
}
